#pragma once

#include <stdint.h>
#include <map>
#include <memory>

namespace rr {
namespace nio {

class EventRecord
{
public:
    using Sptr = std::shared_ptr<EventRecord>;

    enum Type {
        UNKNOWN = 0,
        ASYNC = 1,
        TCP = 2,
        TIMER = 3
    };

    EventRecord(Type type, void* event_ptr);
    ~EventRecord();

public:
    uint64_t timestamp_ = 0;
    Type type_ = TCP;
    void* event_ptr_ = nullptr;
};

class EventRecorder
{
public:
    using Sptr = std::shared_ptr<EventRecorder>;


    EventRecorder();
    ~EventRecorder();

    void Dump();
    void AddRecord(const EventRecord::Sptr& record);
    void RemoveRecord(void *event_ptr);

private:
    std::map<uint64_t, EventRecord::Sptr> records_;
};

} //namespace 
} //namespace 
